Ext.define('AM.view.MyWeekProcedureView', {
		extend: 'Ext.grid.Panel',
		alias : 'widget.myweekProcedureView',
		store : 'MyProcedureStore',
		columnLines:true,
		plugins: [{
            ptype: 'rowexpander',
            rowBodyTpl : new Ext.XTemplate(
                '<p><b>要求:</b> {jobRequirement}</p>'  
            )
        }],
		columns: [
			        //{ text: '序号', width:50,align:'center', xtype: 'rownumberer'},
		            {text: '序号',  xtype: 'rownumberer',width:50,align:'center',tdCls:'background-color: #8EE5EE;'},
			        { text: '名称', dataIndex: 'name', width:280,align:'center'},
			        { text: '开始时间', dataIndex: 'startdate', width:100,align:'center',xtype: 'datecolumn',   format:'Y-m-d'},
			        { text: '完成时间', dataIndex: 'actualCompleteDate', width:100,align:'center',xtype: 'datecolumn',   format:'Y-m-d'},
			        { text: '状态', dataIndex: 'state',  width:80,align:'center',renderer: function(value){
								 if (value === 1) {
										  return '<span style="color:purple;">未办理</span>'; 
								 }if (value ===2) {
								 	  return '<span style="color:green;">办理中</span>';
								 }if (value === 3) {
										return '<span style="color:red;">完成</span>';
								 }	
						}					 
			        },
			        { text: '要求', dataIndex: 'jobRequirement', width:400,align:'center'}
         	    	
			     ],
			      tbar: [
					  {xtype : "datefield",
						 fieldLabel: '查询日期',
						 labelWidth:60,
						 name: 'searchdate',
						 format:'Y-m-d',
						 id:"searchWeekProcedure"
					  },
					  { xtype: 'button', text: '查询',handler:searchMyWeekProcedure,icon : 'Ext/restful/images/find.png'
					  }
					]

})
//办理工作
 function searchMyWeekProcedure(id){
 				var date= Ext.getCmp('searchWeekProcedure').getValue();
			 	var grid=this.ownerCt.ownerCt;
			 	 grid.getStore().on('beforeload', function (store, options) {
			      var new_params = {serchdate:Ext.util.Format.date(date, 'Y-m-d')}
                                    Ext.apply(store.proxy.extraParams, new_params);
                });//此处为加载条件
			    grid.getStore().reload();
   	  	
   
 }
